package tech.abing.spider.constants;

import java.util.HashMap;
import java.util.Map;

import tech.abing.spider.util.SysUtil;


public class FinalConstants {

	public static final String ENCODING_UTF8 = "UTF-8";
	
	public static final int BATCH_NUM = 500;//批量sql
	
	public final static String USERAGNET = "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0";
	
	public final static String TOBAO_PRODUCT_URL = "https://detail.taobao.com/item.htm?id={0}";
	
	public final static String BROWSER_CACHE_DIRECTORY = "cache/";
	
	public static final String CRAWL_STORAGE_FOLDER_PREFIX = "data/crawl/";
	
	public static final String SPLIT = "\001";
	
	public static final String ENTER_CHAR = "\n";
	
	public static final String SHOP_TYPE_TAMLL = "TMALL";
	public static final String SHOP_TYPE_TAOBAO = "TAOBAO";
	
	public static final Map<String, String> rankMap = new HashMap<String, String>();
	static{
		
		rankMap.put("b_red_1.gif", "4－10");
		rankMap.put("b_red_2.gif", "11－40");
		rankMap.put("b_red_3.gif", "41－90");
		rankMap.put("b_red_4.gif", "91－150");
		rankMap.put("b_red_5.gif", "151－250");
		
		rankMap.put("b_blue_1.gif", "251－500");
		rankMap.put("b_blue_2.gif", "501－1000");
		rankMap.put("b_blue_3.gif", "1001－2000");
		rankMap.put("b_blue_4.gif", "2001－5000");
		rankMap.put("b_blue_5.gif", "5001－10000");
		
	}
	
	/* 产品ID任务队列 */
	public static final String REDIS_TASK_PRODUCT_ID = SysUtil.getValue("redis.task_product_id");
	
	/* 为了抓产品从redis中一次出队的产品ID数量*/
	public static final int REDIS_GET_PRODUCT_ID_FOR_PRODUCT = 50;
	
	/* 为了抓交易记录从redis中一次出队的产品ID数量*/
	public static final int REDIS_GET_PRODUCT_ID_FOR_TRADE = 1;
	
	/*热销队列*/
	/*产品月销量*/
	public static final int PRODUCT_HOT_SALE_MIN = 30000;
	public static final int PRODUCT_HOT_SALE_MIN_DAY = 750;
	public static final int DIFF_HOURS_HOT = 2;
	
	/*普通队列*/
	public static final int PRODUCT_NORMAL_SALE_MIN = 1000;
	public static final int PRODUCT_NORMAL_SALE_MIN_DAY = 45;
	public static final int DIFF_HOURS_NORMAL = 2;
	
	/*滞销队列*/
	public static final int PRODUCT_UNSALE_SALE_MIN = 0;
	public static final int PRODUCT_UNSALE_SALE_MIN_DAY = 0;
	public static final int DIFF_HOURS_UNSALE = 8;//暂时24，//TODO:第一天测试用,后续要改过来
	
	/* 保证产品ID的唯一SET集合 */
	
	public static final int JSOUP_TIME_OUT = 10000;
	
	public static final int FORBID_WAIT_SECONDS = 60;//访问受限等待多少秒
	public static final int WAIT_TASK_SECONDS = 1;//等待剩余任务
	
	public static final int TRADE_COOKIE_NUM = 3;//抓取交易记录使用的Cookie个数
	
}
